package Entities;

import Entities.Advantages.IAdvantage;
import Visitor.IVisitor;

public class Brick implements Entities.Drawable {

    private int x;
    private int y;
    private final int width = 50;
    private final int height = 20;
    private int resistance;
    private int score;
    private int id;
    private IAdvantage advantage;

    public Brick(int x, int y, IAdvantage advantage, int resistance) {
        this.x = x;
        this.y = y;
        this.resistance = resistance;
        this.advantage = advantage;
        this.score = 100;
    }

    public Brick() {
        this.score = 100;
    }

    @Override
    public Drawable accept(IVisitor visitor) {
        return visitor.visit(this);
    }

    @Override
    public void addChild(Drawable drawable) {
    }

    @Override
    public void remove(Drawable drawable) {
    }

    @Override
    public Drawable getChild(int pos) {
        return null;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public IAdvantage getAdvantage() {
        return advantage;
    }

    public void setAdvantage(IAdvantage advantage) {
        this.advantage = advantage;
        this.advantage.setX(getX() + getWidth() / 2 - advantage.getWidth()/2);
    }

    public int getResistance() {
        return resistance;
    }

    public void setResistance(int resistance) {
        this.resistance = resistance;
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }

    @Override
    public int getNumElems() {
        return 0;
    }

    public int getScore() {
        return score;
    }

    @Override
    public int getId() {
        return id;
    }

    @Override
    public void setId(int id) {
        this.id = id;
    }
}
